package com.hong.springboot.controller;

import com.hong.springboot.common.HelloWorldClient;
import com.hong.springboot.utils.DataResponse;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: csh
 * @Date: 2020/8/18 16:11
 * @Description:
 */
@RestController
@RequestMapping("/")
@Log4j2
public class UserController {


    @Autowired
    private HelloWorldClient helloWorldClient;

    @RequestMapping(value = "", method = RequestMethod.GET)
    @ResponseBody
    public DataResponse <Boolean> sendMsg(String msg) {
        try {
            log.info("请求进来了{}", msg);
            String test= helloWorldClient.sayHello("测试");
            return DataResponse.BuildSuccessResponse(test);
        } catch (Exception e) {
            log.error("发送出错!{}", e);
        }
        return DataResponse.BuildFailResponse("发送出错！");
    }
}
